<% title "Periods" %>

<div id="new_period">
  <%= render :partial => 'new_period', :locals  => {:period => @period} %>
</div>

<div class="span-24">
  <table  border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
        <th class="span-6">Start Date</th>
        <th class="span-6">End Date</th>
        <th class="span-4">Transactions</th>
        <th class="span-2 right">Processed</th>
        <th class="span-2 right">Outstanding</th>
        <th class="span-2 right">Remaining</th>
        <th class="span-1"/>
        <th class="last"/>
      </tr>
    </thead>
    <tbody>
      <% for period in @periods %>
        <tr>
          <td><%=h period.start_date %></td>
          <td><%=h period.end_date %></td>
          <td><%= link_to pluralize(period.transactions.size, 'transaction'), period_transactions_path(period) %></td>
          <td class="right"><%= number_to_currency(period.processed_transactions_total) %></td>
          <td class="right"><%= number_to_currency(period.outstanding_transactions_total) %></td>
          <td class="right"><%= number_to_currency(period.total_transactions) %></td>
          <td><%= link_to 'Edit', edit_period_path(period) %></td>
          <td><%= link_to 'Destroy', period, :confirm => 'Are you sure?', :method => :delete %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>
<br />
